# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Run.V1.Model.TrafficTarget do
  @moduledoc """
  TrafficTarget holds a single entry of the routing table for a Route.

  ## Attributes

  *   `configurationName` (*type:* `String.t`, *default:* `nil`) - [Deprecated] Not supported in Cloud Run. It must be empty.
  *   `latestRevision` (*type:* `boolean()`, *default:* `nil`) - Uses the "status.latestReadyRevisionName" of the Service to determine the traffic target. When it changes, traffic will automatically migrate from the prior "latest ready" revision to the new one. This field must be false if RevisionName is set. This field defaults to true otherwise. If the field is set to true on Status, this means that the Revision was resolved from the Service's latest ready revision.
  *   `percent` (*type:* `integer()`, *default:* `nil`) - Percent specifies percent of the traffic to this Revision or Configuration. This defaults to zero if unspecified.
  *   `revisionName` (*type:* `String.t`, *default:* `nil`) - Points this traffic target to a specific Revision. This field is mutually exclusive with latest_revision.
  *   `tag` (*type:* `String.t`, *default:* `nil`) - Tag is used to expose a dedicated url for referencing this target exclusively.
  *   `url` (*type:* `String.t`, *default:* `nil`) - Output only. URL displays the URL for accessing tagged traffic targets. URL is displayed in status, and is disallowed on spec. URL must contain a scheme (e.g. https://) and a hostname, but may not contain anything else (e.g. basic auth, url path, etc.)
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :configurationName => String.t() | nil,
          :latestRevision => boolean() | nil,
          :percent => integer() | nil,
          :revisionName => String.t() | nil,
          :tag => String.t() | nil,
          :url => String.t() | nil
        }

  field(:configurationName)
  field(:latestRevision)
  field(:percent)
  field(:revisionName)
  field(:tag)
  field(:url)
end

defimpl Poison.Decoder, for: GoogleApi.Run.V1.Model.TrafficTarget do
  def decode(value, options) do
    GoogleApi.Run.V1.Model.TrafficTarget.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Run.V1.Model.TrafficTarget do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
